widget-factory: Use the new themes
authorMatthias Clasen <mclasen@redhat.com>
Fri, 15 Jan 2021 06:07:47 +0000 (01:07 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 1 Apr 2021 16:27:35 +0000 (12:27 -0400)
Update the Style menu to switch between the variants
of the Default theme.

demos/widget-factory/widget-factory.c
demos/widget-factory/widget-factory.ui

index 8e8da85f4a1e735515f1b3e03a770823859e3c0c..220ba204fa79fcd5f9cdc9ff9f52c07e0aa40367 100644 (file)
@@ -50,32 +50,19 @@ change_theme_state (GSimpleAction *action,
   GtkSettings *settings = gtk_settings_get_default ();
   const char *s;
   const char *theme;
-  gboolean prefer_dark = FALSE;
 
   g_simple_action_set_state (action, state);
 
   s = g_variant_get_string (state, NULL);
 
-  if (strcmp (s, "adwaita") == 0)
-    {
-      theme = "Adwaita";
-      prefer_dark = FALSE;
-    }
-  else if (strcmp (s, "adwaita-dark") == 0)
-    {
-      theme = "Adwaita";
-      prefer_dark = TRUE;
-    }
-  else if (strcmp (s, "highcontrast") == 0)
-    {
-      theme = "HighContrast";
-      prefer_dark = FALSE;
-    }
-  else if (strcmp (s, "highcontrast-inverse") == 0)
-    {
-      theme = "HighContrastInverse";
-      prefer_dark = FALSE;
-    }
+  if (strcmp (s, "default") == 0)
+    theme = "Default";
+  else if (strcmp (s, "dark") == 0)
+    theme = "Default-dark";
+  else if (strcmp (s, "hc") == 0)
+    theme = "Default-hc";
+  else if (strcmp (s, "hc-dark") == 0)
+    theme = "Default-hc-dark";
   else if (strcmp (s, "current") == 0)
     {
       gtk_settings_reset_property (settings, "gtk-theme-name");
@@ -87,7 +74,7 @@ change_theme_state (GSimpleAction *action,
 
   g_object_set (G_OBJECT (settings),
                 "gtk-theme-name", theme,
-                "gtk-application-prefer-dark-theme", prefer_dark,
+                "gtk-application-prefer-dark-theme", FALSE,
                 NULL);
 }
 
index 2153591e306f4bb4b65a96d2ef7888a73329a1ad..269b3f459f1ceaa89660e238b566b92f7498f841 100644 (file)
             <attribute name="target">current</attribute>
           </item>
           <item>
-            <attribute name="label" translatable="yes">Adwaita</attribute>
+            <attribute name="label" translatable="yes">Default</attribute>
             <attribute name="action">win.theme</attribute>
-            <attribute name="target">adwaita</attribute>
+            <attribute name="target">default</attribute>
           </item>
           <item>
-            <attribute name="label" translatable="yes">Adwaita dark</attribute>
+            <attribute name="label" translatable="yes">Dark</attribute>
             <attribute name="action">win.theme</attribute>
-            <attribute name="target">adwaita-dark</attribute>
+            <attribute name="target">dark</attribute>
           </item>
           <item>
-            <attribute name="label" translatable="yes">High contrast</attribute>
+            <attribute name="label" translatable="yes">Highcontrast</attribute>
             <attribute name="action">win.theme</attribute>
-            <attribute name="target">highcontrast</attribute>
+            <attribute name="target">hc</attribute>
           </item>
           <item>
-            <attribute name="label" translatable="yes">High contrast inverse</attribute>
+            <attribute name="label" translatable="yes">Highcontrast inverse</attribute>
             <attribute name="action">win.theme</attribute>
-            <attribute name="target">highcontrast-inverse</attribute>
+            <attribute name="target">hc-dark</attribute>
           </item>
         </section>
       </submenu>